package com.common.controller;

import com.common.domain.Behavior;
import com.common.hbase.constant.PutConstant;
import com.common.hbase.liaison.ParseInterface;
import com.common.hbase.domain.ScanDomain;
import com.common.hbase.instance.HbaseInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hbaseTest")
public class HbaseController {

    @Autowired
    private HbaseInstance hbaseInstance;

    @GetMapping("/index")
    public List<Behavior> isIndex(){
        return new ParseInterface<Behavior>().parseScan(Behavior.class, hbaseInstance.scanTable(new ScanDomain(PutConstant.BEHAVIOR_RECORD_TABLE)));
    }

}
